package com.tengju.bff.interfaces.manage.crm.user.assembler;

import com.google.common.collect.Lists;
import com.tengju.bff.interfaces.app.domination.vo.StarLevelNumVO;
import com.tengju.data.domain.model.clickhouse.star.DominationMemberNew;
import com.tengju.data.domain.model.clickhouse.star.DominationSigningMember;
import com.tengju.data.domain.model.clickhouse.star.DominationUpComing;
import com.tengju.data.domain.model.user.DominationDetail;
import com.tengju.data.domain.model.user.StarLevelEnum;

import java.util.List;
import java.util.Map;

/**
 * @Author: 李大仙
 * @Date: 2021/4/1 9:03 下午
 */
public class CrmDominationAssembler {

    public static List<StarLevelNumVO> assemblerToVO(DominationDetail dominationDetail) {
        List<StarLevelNumVO> starLevelNumVOList = Lists.newArrayList();
        if (dominationDetail == null){
            return starLevelNumVOList;
        }
        Map<StarLevelEnum, Integer> map = dominationDetail.getDominationTeamAllMemberNum();
        for (Map.Entry<StarLevelEnum, Integer> detailEntry : map.entrySet()) {
            starLevelNumVOList.add(StarLevelNumVO.of(detailEntry.getKey(), detailEntry.getValue()));
        }
        return starLevelNumVOList;
    }

    public static List<StarLevelNumVO> assemblerToVO(DominationMemberNew dominationMemberNew) {
        List<StarLevelNumVO> starLevelNumVOList = Lists.newArrayList();
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.NONE, dominationMemberNew.getNewDealerNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_ONE, dominationMemberNew.getNewCityStarOneNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_TWO, dominationMemberNew.getNewCityStarTwoNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_THREE, dominationMemberNew.getNewCityStarThreeNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_FOUR, dominationMemberNew.getNewCityStarFourNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.EC, dominationMemberNew.getNewEcNum()));
        return starLevelNumVOList;
    }

    public static List<StarLevelNumVO> assemblerToVO(DominationSigningMember dominationSigningMember) {
        List<StarLevelNumVO> starLevelNumVOList = Lists.newArrayList();
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_ONE, dominationSigningMember.getSigningCityStarOneNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_TWO, dominationSigningMember.getSigningCityStarTwoNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_THREE, dominationSigningMember.getSigningCityStarThreeNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_FOUR, dominationSigningMember.getSigningCityStarFourNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.EC, dominationSigningMember.getSigningEcNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.SEC, dominationSigningMember.getSigningSecNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.EEC, dominationSigningMember.getSigningEecNum()));
        return starLevelNumVOList;
    }

    public static List<StarLevelNumVO> assemblerToVO(DominationUpComing dominationUpComing) {
        List<StarLevelNumVO> starLevelNumVOList = Lists.newArrayList();
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_ONE, dominationUpComing.getUpComingCityStarOneNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_TWO, dominationUpComing.getUpComingCityStarTwoNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_THREE, dominationUpComing.getUpComingCityStarThreeNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.CITY_STAR_FOUR, dominationUpComing.getUpComingCityStarFourNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.EC, dominationUpComing.getUpComingEcNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.SEC, dominationUpComing.getUpComingSecNum()));
        starLevelNumVOList.add(StarLevelNumVO.of(StarLevelEnum.EEC, dominationUpComing.getUpComingEecNum()));
        return starLevelNumVOList;
    }
}